﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="MailSortSettingService.cs" company="DST Nexdox">
//   Copyright (c) DST Nexdox. All rights reserved.
// </copyright>
// <summary>
//   Defines the MailSortSettingService type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace Services
{
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using DocProcessingRepository.Interfaces;
  using Entities;
  using Exceptions;
  using ServiceInterfaces;

  public class MailSortSettingService : IMailSortSettingService
  {
    private readonly IMailSortSettingRepository mailSortSettingRepository;

    public MailSortSettingService(IMailSortSettingRepository mailSortSettingRepository)
    {
      this.mailSortSettingRepository = mailSortSettingRepository;
    }

    public List<MailsortSetting> GetMailsortSettings()
    {
      try
      {
        return this.mailSortSettingRepository.GetMailsortSettings();
      }
      catch (Exception e)
      {
        throw new DocProcessingException("Unable to get mail sort settings", e);
      }
    }

    public MailsortSetting AddMailSortSetting(String tntDepot, String tntMailingHouse, String tntClientCode, String tntJobReference, String nexdoxMailsortService, Boolean largeLetter, Int32? fixedWeightNoOuter)
    {
      try
      {
        return this.mailSortSettingRepository.AddMailSortSetting(
          tntDepot,
          tntMailingHouse,
          tntClientCode,
          tntJobReference,
          nexdoxMailsortService,
          largeLetter,
          fixedWeightNoOuter);
      }
      catch (Exception e)
      {
        throw new DocProcessingException("Unable to add mail sort setting", e);
      }
    }
  }
}
